{include file="header/index" /}
<meta charset="UTF-8">
	<style>
		.form-control {
			height: 33px;
		}
	</style>

	<body>
		<div class="wrapper wrapper-content animated fadeInRight container">
			<div class="row">
				<div class="col-sm-12 pl0 pr0">
					<div class="ibox float-e-margins">
						<div class="ibox-title">
							<h5>编辑菜单</h5>
							<div class="ibox-tools">
								<a class="collapse-link">
									<i class="fa fa-chevron-up"></i>
								</a>
								<a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
									<i class="fa fa-wrench"></i>
								</a>
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="ibox-content">
							<form class="form-horizontal m-t" name="edit_rule" id="edit_rule" method="post" action="">
								<input type="hidden" name="id" value="{$data.id}">
								<div class="form-group">
									<label class="col-sm-3 control-label">菜单名称：</label>
									<div class="input-group col-sm-4">
										<input id="title" type="text" class="form-control" name="title" required="" aria-required="true" value="{$data.title}">
									</div>
								</div>
								
								
								
								<?php if(empty($data['pid'])){ ?>
									<div class="hr-line-dashed"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label">CSS样式：</label>
										<div class="input-group col-sm-4">
											<input type="text" name="css" id="css" placeholder="输入CSS样式" class="form-control" value="{$data.css}">
										<a class="fl mt5 mr10 col-127" href="http://fontawesome.dashgame.com/" target="_blank">选择图标</a><span class="help-block m-b-none fl">如：如fa fa-user</span>
										</div>
									</div>
								<?php }?>
								
								
								<div class="hr-line-dashed"></div>

								<div class="form-group">
									<label class="col-sm-3 control-label">节点：</label>
									<div class="input-group col-sm-4">
										<input type="text" name="url" id="url" value="{$data.url}" placeholder="模块/控制器/方法" class="form-control">
										<span class="help-block m-b-none">如：admin/user/adduser (顶级节点添加“#”即可) </span>
									</div>
								</div>

								<div class="hr-line-dashed"></div>
								<div class="form-group">
									<label class="col-sm-3 control-label"> 状&nbsp;态：</label>
									<div class="col-sm-6">
										<div class="switchery-radio" style="padding-top: 8px;">
											<input type="checkbox" id="status" name="status" value="1" class="js-switch" {if condition="$data['status'] eq 1"}checked{/if}> 默认开启
										</div>
									</div>
								</div>
								<div class="hr-line-dashed"></div>
								<div class="form-group">
									<label class="col-sm-3 control-label"> 排序：</label>
									<div class="input-group col-sm-5">
										<input type="text" name="sort" id="sort" value="{$data.sort}" placeholder="输入排序" class="form-control">
									</div>
								</div>
								<div class="hr-line-dashed"></div>
								<div class="form-group">
									<div class="col-sm-4 col-sm-offset-3">
										<button class="btn btn-primary" type="button" onclick="updateMenu()"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
										<a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
									</div>
								</div>
							</form>
						</div>
					</div>

				</div>
			</div>
		</div>
	</body>



<script>
	/**
	 * 修改系统菜单栏
	 */
	function updateMenu(){
		var title = $("input[name='title']").val();
		var url = $("input[name='url']").val();
		var sort = $("input[name='sort']").val();
		var id = $("input[name='id']").val();
		var css = $("input[name='css']").val();
		if($('#status').is(':checked')) {
		    var status = 1;
		}else{
			var status = 0;
		}
		$.post("{:url('Menu/ModifyTheSort')}",{title:title,url:url,sort:sort,id:id,status:status,css:css},function(e){
			if(e.code == '1'){
				layer.msg(e.msg, {icon: 1,time: 2000},function(){window.location.href="{:url('Authgroup/index')}?type=3"});
			}else{
				layer.msg(e.msg, {icon: 2,time: 2000});
			}
		},'json');
	}



</script>






</html>